package fun.fanyu.mygpt.controller;

import fun.fanyu.mygpt.controller.in.UserIn;
import fun.fanyu.mygpt.controller.out.UserOut;
import org.springframework.web.bind.annotation.CrossOrigin;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RestController;

/**
 * @version V3.0
 * @Title: DemoController
 * @Description: 描述
 * @author: Trident
 * @date 2023/7/5 8:34 AM
 */
@RestController
@CrossOrigin(origins = "*")
public class DemoController {

    @PostMapping("/login")
    UserOut login(@RequestBody UserIn userIn) {
        UserOut userOut = new UserOut();
        if (userIn.getMobile().equals("13800000002")) {
            if (userIn.getPassword().equals("123456")) {
                userOut.setCode(10000);
                userOut.setSuccess(true);
                userOut.setMessage("登录成功");
                userOut.setData("dsafewfaeaefeafefa");
            } else {
                userOut.setCode(10003);
                userOut.setSuccess(false);
                userOut.setMessage("密码不正确");
            }
        } else {
            userOut.setCode(10002);
            userOut.setSuccess(false);
            userOut.setMessage("账号不正确");
        }
        return userOut;
    }
}
